//
//  LocatedPlayer.m
//
//  Created by Kevin Schewior on 04.12.11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "LocatedPlayer.h"

@implementation LocatedPlayer

@synthesize last_position_long, last_position_lat, last_position_accuracy, last_position_update, allowed_to_catch;

-(id)initWithCoder:(NSCoder *)aDecoder{
    self = [super initWithCoder:aDecoder];
    if (self) {
        last_position_update = [[aDecoder decodeObjectForKey:@"last_position_update"] retain];
        last_position_long = [aDecoder decodeDoubleForKey:@"last_position_long"];
        last_position_lat = [aDecoder decodeDoubleForKey:@"last_position_lat"];		
        last_position_accuracy = [aDecoder decodeDoubleForKey:@"last_position_accuracy"];
        allowed_to_catch = [aDecoder decodeBoolForKey:@"allowed_to_catch"];        
    }
    
    return self;
}

-(void)encodeWithCoder:(NSCoder *)aCoder{
	[super encodeWithCoder:aCoder];
    [aCoder encodeObject:last_position_update forKey:@"last_position_update"];
    [aCoder encodeDouble:last_position_long forKey:@"last_position_long"];
    [aCoder encodeDouble:last_position_lat forKey:@"last_position_lat"];	
    [aCoder encodeDouble:last_position_accuracy forKey:@"last_position_accuracy"];
    [aCoder encodeBool:allowed_to_catch forKey:@"allowed_to_catch"];    
}

-(void)dealloc{
    [last_position_update release];
	[super dealloc];
}

#pragma Located methods

-(double) latitude {
  return last_position_lat;
}

-(double) longitude {
  return last_position_long;
}

-(double) accuracy {
  return last_position_accuracy;
}

-(NSDate*) lastUpdate {
  return last_position_update;
}

@end
